public void Serialize_Works() { // Arrange, var text = SampleStrings.GetRecordString(SampleStrings.PatrolsString); var tokens = text.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var expected = SampleObjects.EnemyPatrol; var record = TokenParser.ParseTokens(tokens).GetRecord(PatrolsSerializer.Patrols); var target = new PatrolsSerializer(); // Act, var actual = target.Serialize(record); // Assert, Assert.AreEqual(expected, actual[0]); }
public void GetMusic_Works() { // Arrange, var text = SampleStrings.GetRecordString(SampleStrings.MusicString); var tokens = text.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var expected = SampleObjects.Music; var record = TokenParser.ParseTokens(tokens).GetRecord(MusicSerializer.Music); var target = new MusicSerializer(); // Act, var actual = target.Serialize(record); // Assert, Assert.AreEqual(expected, actual); }
public void WhereIf_WithTrue_ApplyFilter() { // Arrange var queryable = SampleStrings.GetAsList().AsQueryable(); var queryableWithStr1 = new List <string> { SampleStrings.str1 }.AsQueryable(); // Act var ret = queryable.WhereIf(true, x => x.Equals(SampleStrings.str1)); // Assert ret.Should().HaveCount(1); ret.Should().BeEquivalentTo(queryableWithStr1); ret.Should().NotBeSameAs(queryableWithStr1); ret.Should().NotBeSameAs(queryable); }
public void WhereIf_WithTrue_ApplyFilter() { // Arrange var list = SampleStrings.GetAsList(); var listWithStr1 = new List <string> { SampleStrings.str1 }; // Act var ret = list.WhereIf(true, x => x.Equals(SampleStrings.str1)); // Assert ret.Should().HaveCount(1); ret.Should().BeEquivalentTo(listWithStr1); ret.Should().NotBeSameAs(listWithStr1); ret.Should().NotBeSameAs(list); }
public void WhereIf_WithFalse_SkipFilter() { // Arrange var queryable = SampleStrings.GetAsList().AsQueryable(); var originalListCount = queryable.Count(); var queryableWithStr1 = new List <string> { SampleStrings.str1 }.AsQueryable(); // Act var ret = queryable.WhereIf(false, x => x.Equals(SampleStrings.str1)); // Assert ret.Should().HaveCount(originalListCount); ret.Should().NotBeEquivalentTo(queryableWithStr1); ret.Should().NotBeSameAs(queryableWithStr1); ret.Should().BeEquivalentTo(queryable); ret.Should().BeSameAs(queryable); }
public void WhereIf_WithFalse_SkipFilter() { // Arrange var list = SampleStrings.GetAsList(); var originalListCount = list.Count; var listWithStr1 = new List <string> { SampleStrings.str1 }; // Act var ret = list.WhereIf(false, x => x.Equals(SampleStrings.str1)); // Assert ret.Should().HaveCount(originalListCount); ret.Should().NotBeEquivalentTo(listWithStr1); ret.Should().NotBeSameAs(listWithStr1); ret.Should().BeEquivalentTo(list); ret.Should().BeSameAs(list); }