Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/16/10 10:21:41 (14 years ago)
Author:
epitzer
Message:

Fix warnings (#915)

Location:
trunk/sources/HeuristicLab.Persistence/3.3/Tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Tests/HeuristicLab.Persistence-3.3.Tests.csproj

    r2951 r3057  
    3030    <ErrorReport>prompt</ErrorReport>
    3131    <WarningLevel>4</WarningLevel>
     32    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    3233  </PropertyGroup>
    3334  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
  • trunk/sources/HeuristicLab.Persistence/3.3/Tests/StorableAttributeTests.cs

    r3025 r3057  
    1212
    1313    [Storable(Name = "TestProperty", DefaultValue = 12)]
    14     public object o;
     14    public object o = null;
    1515
    1616    [Storable]
    1717    public int x = 2;
    1818
    19     public int y;
    20 
     19    public int y = 0;
    2120  }
    2221
  • trunk/sources/HeuristicLab.Persistence/3.3/Tests/UseCases.cs

    r3029 r3057  
    4141    [Storable]
    4242    private ulong _ulong = 123456;
     43    public override bool Equals(object obj) {
     44      NumberTest nt = obj as NumberTest;
     45      if (nt == null)
     46        throw new NotSupportedException();
     47      return
     48        nt._bool == _bool &&
     49        nt._byte == _byte &&
     50        nt._sbyte == _sbyte &&
     51        nt._short == _short &&
     52        nt._ushort == _ushort &&
     53        nt._int == _int &&
     54        nt._uint == _uint &&
     55        nt._long == _long &&
     56        nt._ulong == _ulong;
     57    }
     58    public override int GetHashCode() {
     59      return
     60        _bool.GetHashCode() ^
     61        _byte.GetHashCode() ^
     62        _sbyte.GetHashCode() ^
     63        _short.GetHashCode() ^
     64        _short.GetHashCode() ^
     65        _int.GetHashCode() ^
     66        _uint.GetHashCode() ^
     67        _long.GetHashCode() ^
     68        _ulong.GetHashCode();
     69    }
    4370  }
    4471
     
    86113    [Storable]
    87114    private object o = new object();
     115    public override bool Equals(object obj) {
     116      PrimitivesTest pt = obj as PrimitivesTest;
     117      if (pt == null)
     118        throw new NotSupportedException();
     119      return base.Equals(obj) &&
     120        c == pt.c &&
     121        _long_array == pt._long_array &&
     122        list == pt.list &&
     123        o == pt.o;
     124    }
     125    public override int GetHashCode() {
     126      return base.GetHashCode() ^
     127        c.GetHashCode() ^
     128        _long_array.GetHashCode() ^
     129        list.GetHashCode() ^
     130        o.GetHashCode();
     131    }
    88132  }
    89133
     
    96140    [Storable]
    97141    public TestEnum myEnum = TestEnum.va3;
     142    public override bool Equals(object obj) {
     143      RootBase rb = obj as RootBase;
     144      if (rb == null)
     145        throw new NotSupportedException();
     146      return baseString == rb.baseString &&
     147        myEnum == rb.myEnum;
     148    }
     149    public override int GetHashCode() {
     150      return baseString.GetHashCode() ^
     151        myEnum.GetHashCode();
     152    }
    98153  }
    99154
     
    175230
    176231  public class NonSerializable {
    177     int x;
     232    int x = 0;
     233    public override bool Equals(object obj) {
     234      NonSerializable ns = obj as NonSerializable;
     235      if (ns == null)
     236        throw new NotSupportedException();
     237      return ns.x == x;
     238    }
     239    public override int GetHashCode() {
     240      return x.GetHashCode();
     241    }
    178242  }
    179243
     
    377441      [Storable]
    378442      private string value = "value";
     443      public override bool Equals(object obj) {
     444        NestedType nt = obj as NestedType;
     445        if (nt == null)
     446          throw new NotSupportedException();
     447        return nt.value == value;
     448      }
     449      public override int GetHashCode() {
     450        return value.GetHashCode();
     451      }
    379452    }
    380453
     
    387460        DebugStringGenerator.Serialize(t),
    388461        DebugStringGenerator.Serialize(o));
     462      Assert.IsTrue(t.Equals(o));
    389463    }
    390464
     
    465539        DebugStringGenerator.Serialize(sdt),
    466540        DebugStringGenerator.Serialize(o));
     541      Assert.IsTrue(sdt.Equals(o));
    467542    }
    468543
Note: See TracChangeset for help on using the changeset viewer.